package com.hangzhou.xyj.manager;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.hangzhou.xyj.R;
import com.hangzhou.xyj.XYJApplication;
import com.hangzhou.xyj.model.DianDramaModel;
import com.hangzhou.xyj.model.DramaModel;
import com.hangzhou.xyj.model.RecordModel;
import com.hangzhou.xyj.model.UserModel;
import com.hangzhou.xyj.model.type.EIntentTagType;
import com.hangzhou.xyj.model.type.EUserType;
import com.hangzhou.xyj.ui.activity.APITestActivity;
import com.hangzhou.xyj.ui.activity.AboutUsActivity;
import com.hangzhou.xyj.ui.activity.AddGroupActivity;
import com.hangzhou.xyj.ui.activity.BookActivity;
import com.hangzhou.xyj.ui.activity.BookDetailActivity;
import com.hangzhou.xyj.ui.activity.BuildInfoActivity;
import com.hangzhou.xyj.ui.activity.ChatActivity;
import com.hangzhou.xyj.ui.activity.CommentActivity;
import com.hangzhou.xyj.ui.activity.DramaCategoryListActivity;
import com.hangzhou.xyj.ui.activity.DramaPlayActivity;
import com.hangzhou.xyj.ui.activity.DynamicDetailActivity;
import com.hangzhou.xyj.ui.activity.ExpertInfoActivity;
import com.hangzhou.xyj.ui.activity.FindActionActivity;
import com.hangzhou.xyj.ui.activity.GroupActivity;
import com.hangzhou.xyj.ui.activity.GroupDetailActivity;
import com.hangzhou.xyj.ui.activity.GroupInfoActivity;
import com.hangzhou.xyj.ui.activity.GroupMemberActivity;
import com.hangzhou.xyj.ui.activity.GuideActivity;
import com.hangzhou.xyj.ui.activity.HomePageActivity;
import com.hangzhou.xyj.ui.activity.LocalPlayActivity;
import com.hangzhou.xyj.ui.activity.LoginActivity;
import com.hangzhou.xyj.ui.activity.MainActivity;
import com.hangzhou.xyj.ui.activity.MoreGroupActivity;
import com.hangzhou.xyj.ui.activity.MyActiveInfoActivity;
import com.hangzhou.xyj.ui.activity.MyAuthenDialogActivity;
import com.hangzhou.xyj.ui.activity.MyCollectionActivity;
import com.hangzhou.xyj.ui.activity.MyCommentActivity;
import com.hangzhou.xyj.ui.activity.MyGroupActivity;
import com.hangzhou.xyj.ui.activity.MyGroupAuthenActivity;
import com.hangzhou.xyj.ui.activity.MyMessageActivity;
import com.hangzhou.xyj.ui.activity.MyOfficalMessageActivity;
import com.hangzhou.xyj.ui.activity.MyPersonalInfoActivity;
import com.hangzhou.xyj.ui.activity.MyProfessionAuthenActivity;
import com.hangzhou.xyj.ui.activity.MySettingActivity;
import com.hangzhou.xyj.ui.activity.MySystemMessageActivity;
import com.hangzhou.xyj.ui.activity.NoPlayingActvity;
import com.hangzhou.xyj.ui.activity.PhotoViewActivity;
import com.hangzhou.xyj.ui.activity.PreviewRecordActivity;
import com.hangzhou.xyj.ui.activity.PublishActActivity;
import com.hangzhou.xyj.ui.activity.PublishDynamicActivity;
import com.hangzhou.xyj.ui.activity.PublishRecordActivity;
import com.hangzhou.xyj.ui.activity.RecordActivity;
import com.hangzhou.xyj.ui.activity.RegisterActivity;
import com.hangzhou.xyj.ui.activity.RetrievePasswordActivity;
import com.hangzhou.xyj.ui.activity.SearchActivity;
import com.hangzhou.xyj.ui.activity.ShowActivity;
import com.hangzhou.xyj.ui.activity.SignUpActivity;
import com.hangzhou.xyj.ui.activity.SingAloneActivity;
import com.hangzhou.xyj.ui.activity.SingingListActivity;
import com.hangzhou.xyj.ui.activity.UpdatePasswordActivity;
import com.hangzhou.xyj.ui.activity.WebActivity;
import com.hangzhou.xyj.utils.LogUtil;
import com.hangzhou.xyj.utils.StringUtil;
import com.hangzhou.xyj.utils.ToastUtil;
import com.hangzhou.xyj.utils.constants.AppConstants;
import com.hangzhou.xyj.utils.constants.DataKey;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author neo.duan Activity的跳转管理器
 */
public class IntentManager {
    private final String TAG = "IntentManager";

    private IntentManager() {
    }

    public static final IntentManager getInstance() {
        return IntentManagerHolder.instance;
    }

    private void startActivity(Context context, Intent intent) {
        if (context == null) {
            return;
        }
        context.startActivity(intent);
        if (context instanceof Activity) {
            ((Activity) context).overridePendingTransition(R.anim.anim_push_left_in,
                    R.anim.anim_push_left_out);
        }
    }

    private void startAcitivityForResult(Activity context, Intent intent,
                                         int requestCode) {
        if (context == null) {
            return;
        }
        context.startActivityForResult(intent, requestCode);
    }

    public void goActivity(Context context, Intent intent) {
        startActivity(context, intent);
    }

    public void goMyOfficalMessageActivity(Context context) {
        Intent intent = new Intent(context, MyOfficalMessageActivity.class);
        startActivity(context, intent);
    }

    /**
     * 跳转到首页Activity
     *
     * @param context
     */
    public void goMainActivity(Context context) {
        Intent intent = new Intent(context, MainActivity.class);
        startActivity(context, intent);
//        startActivity(context, new Intent(context, TestActivity.class));
    }

    /**
     * 跳转到关于戏友记
     *
     * @param context
     */
    public void goAboutUs(Context context) {
        Intent intent = new Intent(context, AboutUsActivity.class);
        startActivity(context, intent);
    }

    /**
     * 跳转到引导页
     *
     * @param context
     */
    public void goGuideActivity(Context context) {
        startActivity(context, new Intent(context, GuideActivity.class));
    }

    public void goMainActivity(Context context, int intentFlags) {
        Intent intent = new Intent(context, MainActivity.class);
//        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        intent.addFlags(intentFlags);
        startActivity(context, intent);
    }

    /**
     * 跳转到登录界面
     *
     * @param context
     */
    public void goLoginActivity(Context context) {
        startActivity(context, new Intent(context, LoginActivity.class));
    }

    /**
     * 跳转到我的消息
     *
     * @param context
     */
    public void goMyMessageActivity(Context context) {
        startActivity(context, new Intent(context, MyMessageActivity.class));
    }

    /**
     * 跳转到群成员列表页面
     *
     * @param EMGroupId     环信群id
     * @param groupMasterId 群主ID
     * @return
     * @author yaohuix
     * @date 2016/5/9 16:48
     */
    public void goGroupMemberActivity(Context context, String EMGroupId, String groupCode, String groupMasterId) {
        Intent intent = new Intent(context, GroupMemberActivity.class);
        intent.putExtra(DataKey.INDEX, EMGroupId);
        intent.putExtra(DataKey.GROUP_CODE, groupCode);
        intent.putExtra(DataKey.USER_ID, groupMasterId);
        startActivity(context, intent);
    }

    /**
     * 跳转到注册界面
     *
     * @param context
     */
    public void goRegisterActivity(Context context) {
        startActivity(context, new Intent(context, RegisterActivity.class));
    }

    /**
     * 跳转到报名页面
     *
     * @param
     * @return
     * @author yaohuix
     * @date 2016/4/21 10:22
     */
    public void goSingUpActivity(Context context) {
        startActivity(context, new Intent(context, SignUpActivity.class));
    }

    /**
     * 跳转到找回密码界面
     *
     * @param context
     */
    public void goRetrievePasswordActivity(Context context) {
        startActivity(context, new Intent(context, RetrievePasswordActivity.class));
    }

    /**
     * 跳转到修改密码界面
     *
     * @param context
     */
    public void goUpdatePasswordActivity(Context context) {
        startActivity(context, new Intent(context, UpdatePasswordActivity.class));
    }

    /**
     * 跳转到他人的个人信息
     *
     * @param context
     */
    public void goPersonalInfoActivity(Context context, Intent intent) {
        startActivity(context, intent);
    }

    /**
     * 跳转到我的个人信息界面
     *
     * @param context
     */
    public void goMinePersonalInfoActivity(Context context) {
        startActivity(context, new Intent(context, MyPersonalInfoActivity.class));
    }

    /**
     * 跳转到ExpertInfoActivity页面 或者 HomePageActivity页面
     *
     * @param
     * @return
     * @author yaohuix
     * @date 2016/5/25 13:30
     */

    public void goExpertInfoActivity(Context context, int userId, String userName, EUserType userType) {
        Intent intent;
        switch (userType) {
            case FAMOUS_EXPERT://名家
                intent = new Intent(context, ExpertInfoActivity.class);
                intent.putExtra(DataKey.TITLE, "名家信息");
                intent.putExtra(DataKey.INTENT_TAG, EIntentTagType.TAG_STAGE_EXPERT.getValue());
                break;
            case AUTHORIZED_USER://认证用户 =  演员
                intent = new Intent(context, ExpertInfoActivity.class);
                intent.putExtra(DataKey.TITLE, "演员信息");
                intent.putExtra(DataKey.INTENT_TAG, EIntentTagType.TAG_STAGE_TEAM.getValue());
                break;
            case AUTHORIZED_TEAM://剧团
                intent = new Intent(context, ExpertInfoActivity.class);
                intent.putExtra(DataKey.TITLE, "剧团信息");
                intent.putExtra(DataKey.INTENT_TAG, EIntentTagType.TAG_DRAMA_GROUP.getValue());
                break;
            default://其他
                intent = new Intent(context, HomePageActivity.class);
                intent.putExtra(DataKey.TITLE, userName);
                break;
        }
        intent.putExtra(DataKey.INDEX, userId);
        startActivity(context, intent);
    }

    public void goExpertInfoActivity(Context context, int userId, EIntentTagType intentTagType) {
        Intent intent = new Intent(context, ExpertInfoActivity.class);
        switch (intentTagType) {
            case TAG_STAGE_EXPERT://名家
                intent.putExtra(DataKey.TITLE, "名家信息");
                intent.putExtra(DataKey.INTENT_TAG, EIntentTagType.TAG_STAGE_EXPERT.getValue());
                break;
            case TAG_STAGE_TEAM://演员
                intent.putExtra(DataKey.TITLE, "演员信息");
                intent.putExtra(DataKey.INTENT_TAG, EIntentTagType.TAG_STAGE_TEAM.getValue());
                break;
            case TAG_DRAMA_GROUP://剧团
                intent.putExtra(DataKey.TITLE, "剧团信息");
                intent.putExtra(DataKey.INTENT_TAG, EIntentTagType.TAG_DRAMA_GROUP.getValue());
                break;
        }
        intent.putExtra(DataKey.INDEX, userId);
        startActivity(context, intent);
    }

    /**
     * 跳转到我的设置界面
     *
     * @param context
     */
    public void goMineSettingActvitity(Context context) {
        startActivity(context, new Intent(context, MySettingActivity.class));
    }

    /**
     * 跳转到我的收藏界面
     *
     * @param context
     */
    public void goMineCollectionActivity(Context context) {
        startActivity(context, new Intent(context, MyCollectionActivity.class));
    }

    /**
     * @param @param context
     * @author yaohuix
     * @Description 跳转到“我的消息”界面
     */
    public void goMineMessageActivity(Context context) {
        startActivity(context, new Intent(context, MyMessageActivity.class));
    }

    /**
     * 跳转到更多剧种
     *
     * @param context
     */
    public void goDramaCategoryListActivity(Context context) {
        startActivity(context, new Intent(context, DramaCategoryListActivity.class));
    }

    /**
     * 跳转到圈子
     *
     * @param context
     */
    public void goGroupActivity(Context context) {
        startActivity(context, new Intent(context, GroupActivity.class));
    }

    /**
     * 跳转到web页
     *
     * @param context
     */
    public void goWebActivity(Context context, String url) {
        Intent intent = new Intent(context, WebActivity.class);
        intent.putExtra(DataKey.INDEX, url);
        startActivity(context, intent);
    }

    /**
     * 跳转到更多名家页
     *
     * @param context
     */
    public void goExpertListActivity(Context context) {
//        goExpertListActivity(context, ExpertListActivity.DEFAULT_TAG);
    }

    /**
     * 跳转到搜索页面
     *
     * @param
     * @return
     * @author yaohuix
     * @date 2016/4/22 14:10
     */
    public void goSearchActivity(Context context) {
        Intent intent = new Intent(context, SearchActivity.class);
        startActivity(context, intent);
    }

    /**
     * 跳转到更多名家页
     *
     * @param context
     */
    public void goExpertListActivity(Context context, Intent intent) {
//        Intent intent = new Intent(context, ExpertListActivity.class);
//        intent.putExtra(DataKey.INTENT_TAG, intent);
        startActivity(context, intent);
    }

//    /**
//     * 跳转到名家个人信息
//     *
//     * @param context
//     */
//    public void goExpertInfoActivity(Context context, Intent intent) {
//        startActivity(context, intent);
//    }

    /**
     * 跳转到主页
     *
     * @param context
     */
    public void goHomePageActivity(Context context, Intent intent) {
        startActivity(context, intent);
    }

    /**
     * 跳转到课本页面
     *
     * @param context
     */
    public void goBookActivity(Context context) {
        startActivity(context, new Intent(context, BookActivity.class));
    }

    /**
     * @param @param context
     * @return void
     * @throws
     * @author yaohuix
     * @Description 跳转到“我的评论”界面
     */
    public void goMineCommentActivity(Context context) {
        startActivity(context, new Intent(context, MyCommentActivity.class));
    }

    /**
     * @param @param context
     * @return void
     * @throws
     * @author yaohuix
     * @Description 跳转到修改界面
     */
    public void goCorrectActivity(Activity activity, Intent intent,
                                  int requestCode) {
        startAcitivityForResult(activity, intent, requestCode);
    }

    /**
     * @param @param activity
     * @param @param intent
     * @param @param requestCode
     * @return void
     * @throws
     * @author yaohuix
     * @Description 跳转到”修改签名“界面
     */
    public void goCorrectSignActivity(Activity activity, Intent intent,
                                      int requestCode) {
        startAcitivityForResult(activity, intent, requestCode);
    }

    /**
     * 跳转到我的粉丝页面
     *
     * @param context
     */
    public void goMyFansActivity(Context context, Intent intent) {
        startActivity(context, intent);
    }

    /**
     * 跳转到我的关注页面
     *
     * @param context
     */
    public void goMyFocusActivity(Context context, Intent intent) {
        startActivity(context, intent);
    }

    /**
     * 跳转到我的动态页面
     *
     * @param context
     */
    public void goMyActiveActivity(Context context) {
        startActivity(context, new Intent(context, MyActiveInfoActivity.class));
    }

    /**
     * 跳转到我的圈子页面
     *
     * @param context
     */
    public void goMyGroupActivity(Context context) {
        startActivity(context, new Intent(context, MyGroupActivity.class));
    }

    /**
     * 弹出对话框
     *
     * @param context
     */
    public void goMyAuthenDialogActivity(Context context) {
        startActivity(context, new Intent(context, MyAuthenDialogActivity.class));
    }

    /**
     * 跳转专业认证页面
     *
     * @param context
     */
    public void goMyProfessionAuthenActivity(Context context) {
        startActivity(context, new Intent(context, MyProfessionAuthenActivity.class));
    }

    /**
     * 跳转名团认证页面
     *
     * @param context
     */
    public void goMyGroupAuthenActivity(Context context) {
        startActivity(context, new Intent(context, MyGroupAuthenActivity.class));
    }

    /**
     * 跳转“发现”->"活动"
     *
     * @param context
     */
    public void goFindActionActivity(Context context) {
        startActivity(context, new Intent(context, FindActionActivity.class));
    }

    /**
     * 跳转到动态详情页面
     *
     * @param
     * @return
     * @author yaohuix
     * @date 2016/3/21 11:44
     */
    public void goDynamicDetailActivity(Context context) {
        startActivity(context, new Intent(context, DynamicDetailActivity.class));
    }

    /**
     * 跳转到课本详情
     *
     * @param context
     */
    public void goBookDetailActivity(Context context) {
        startActivity(context, new Intent(context, BookDetailActivity.class));
    }

    /**
     * 跳转聊天页面
     *
     * @param context
     */
//    public void goMyChattingActivity(Context context, String name) {
//        Intent intent = new Intent(context, MyChattingActivity.class);
//        intent.putExtra("name", name);
//        startActivity(context, intent);
//    }

    /**
     * 跳转到发布戏剧活动页面
     *
     * @param context
     */
    public void goPublishActActivity(Context context) {
        startActivity(context, new Intent(context, PublishActActivity.class));
    }

    /**
     * 跳转到新建圈子
     *
     * @param context
     */
    public void goAddGroupActivity(Context context) {
        startActivity(context, new Intent(context, AddGroupActivity.class));
    }

    /**
     * 跳转到演出
     *
     * @param context
     */
    public void goShowActivity(Context context) {
        startActivity(context, new Intent(context, ShowActivity.class));
    }

    /**
     * 跳转到戏曲播放
     *
     * @param context
     */
    public void goDramaPlayActivity(Context context, DramaModel model) {
        if (model == null) {
            Log.e(TAG, "DramaModel is null");
            return;
        }
        AppConstants.CURRENT_TAG_TYPE = null;
        List<DramaModel> list = new ArrayList<>();
        list.add(model);
        goDramaPlayActivity(context, list, 0);
    }

    /**
     * @param intentTagType 区分是从哪个页面进来的
     * @return
     * @author yaohuix
     * @date 2016/5/16 16:27
     */
    public void goDramaPlayActivity(Context context, List<DramaModel> modelList, int dramaPos, EIntentTagType intentTagType) {
        if (modelList == null || modelList.isEmpty()) {
            Log.e(TAG, "DramaModel list is null or empty");
            return;
        }

        Intent intent = new Intent(context, DramaPlayActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.putExtra(DataKey.DRAMA_LIST, (Serializable) modelList);
        intent.putExtra(DataKey.DRAMA_POSITION, dramaPos);
        if (intentTagType != null)
            intent.putExtra(DataKey.INTENT_TAG, intentTagType.getValue());
        startActivity(context, intent);
    }

    /**
     * 跳转到戏曲播放页
     *
     * @param context
     * @param modelList 戏曲集合，用来播放上一首下一首
     * @param dramaPos  当前播放戏曲的位置
     */
    public void goDramaPlayActivity(Context context, List<DramaModel> modelList, int dramaPos) {
        if (modelList == null || modelList.isEmpty()) {
            Log.e(TAG, "DramaModel list is null or empty");
            return;
        }
        AppConstants.CURRENT_TAG_TYPE = null;
        Intent intent = new Intent(context, DramaPlayActivity.class);
//        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.putExtra(DataKey.DRAMA_LIST, (Serializable) modelList);
        intent.putExtra(DataKey.DRAMA_POSITION, dramaPos);
        startActivity(context, intent);
    }

    /**
     * 跳转到戏曲播放页
     *
     * @param context
     * @param modelList 戏曲集合，用来播放上一首下一首
     * @param dramaPos  当前播放戏曲的位置
     */
    public void goRestoreDramaPlayActivity(Context context, List<DramaModel> modelList, int dramaPos) {
        if (modelList == null || modelList.isEmpty()) {
            Log.e(TAG, "DramaModel list is null or empty");
            return;
        }
        Intent intent = new Intent(context, DramaPlayActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.putExtra(DataKey.DRAMA_LIST, (Serializable) modelList);
        intent.putExtra(DataKey.DRAMA_POSITION, dramaPos);
        intent.putExtra(DataKey.INTENT_TAG, EIntentTagType.TAG_PLAY_RESTORE.getValue());
        startActivity(context, intent);
    }


    /**
     * @param
     * @return
     * @Description 更多作品页面
     * @author yaohuix
     * @date 2016/1/28 13:47
     */
    public void goMoreWorksActivity(Context context, Intent intent) {
        startActivity(context, intent);
    }

    /**
     * 没有曲目播放的界面
     *
     * @param
     * @return
     * @author yaohuix
     * @date 2016/5/16 15:58
     */

    public void goNoPlayingActivity(Context context) {
        Intent intent = new Intent(context, NoPlayingActvity.class);
        startActivity(context, intent);
    }

    /**
     * 跳转到圈子明细
     *
     * @param context
     */
    public void goGroupDetailActivity(Context context, String groupCode) {
        if (StringUtil.isBlank(groupCode)) {
            LogUtil.e(TAG, "group code is blank");
        }
        Intent intent = new Intent(context, GroupDetailActivity.class);
        intent.putExtra(DataKey.GROUP_CODE, groupCode);
        startActivity(context, intent);
    }

    /**
     * 跳转到图片选择
     *
     * @param context
     */
    public void goImageSelectorActivity(Activity context, Intent intent, int requestCode) {
        startAcitivityForResult(context, intent, requestCode);
    }

    /**
     * 跳转到系统消息明细
     *
     * @param context
     */
    public void goMySystemMessageActivity(Context context) {
        Intent intent = new Intent(context, MySystemMessageActivity.class);
        startActivity(context, intent);
    }

    /**
     * 跳转到发布动态界面
     *
     * @param context
     */
    public void goPublishDynamicActivity(Context context) {
        startActivity(context, new Intent(context, PublishDynamicActivity.class));
    }

    /**
     * 跳转到更多圈子界面
     *
     * @param context
     */
    public void goMoreGroupActivity(Context context) {
        startActivity(context, new Intent(context, MoreGroupActivity.class));
    }

    /**
     * 跳转到聊天页面
     *
     * @param context
     * @param toUserId
     * @param chatType 聊天类型，是群聊还是单聊EaseConstant.CHATTYPE_SINGLE
     */
    public void goChatActivity(Context context, String toUserId, int chatType) {
        if (StringUtil.isBlank(toUserId)) {
            LogUtil.e(TAG, "to userId is null");
            return;
        }
        UserModel userModel = XYJApplication.getUserInfo();
        if (userModel != null && toUserId.equals(userModel.getUserId())) {
            ToastUtil.show("不能和自己聊天哦");
            return;
        }
        Intent intent = new Intent(context, ChatActivity.class);
        intent.putExtra(DataKey.USER_ID, toUserId);
        intent.putExtra(DataKey.CHAT_TYPE, chatType);
        startActivity(context, intent);
    }

    /**
     * 跳转到评论页面
     *
     * @param context
     * @param contentId 动态内容的id
     * @param tagType
     */
    public void goCommentActivity(Context context, int contentId, EIntentTagType tagType) {
        Intent intent = new Intent(context, CommentActivity.class);
        intent.putExtra(DataKey.OBJ_ID, contentId);
        intent.putExtra(DataKey.INTENT_TAG, tagType.getValue());
        startActivity(context, intent);
    }

    /**
     * 跳转到城市选择页面
     *
     * @param activity
     */
    public void goSelectCityActivity(Activity activity, Intent intent, int requestCode) {
        activity.startActivityForResult(intent, requestCode);
    }

    /**
     * 跳转到群资料页面
     *
     * @param context
     * @param EMGroupId 环信的群ID
     */
    public void goGroupInfoActivity(Context context, String EMGroupId) {
        Intent intent = new Intent(context, GroupInfoActivity.class);
        intent.putExtra(DataKey.INDEX, EMGroupId);
        startActivity(context, intent);
    }

    /**
     * 跳转到录制界面
     *
     * @param context
     */
    public void goRecordActivity(Context context, DianDramaModel model) {
        if (model == null) {
            return;
        }
        Intent intent = new Intent(context, RecordActivity.class);
        intent.putExtra(DataKey.DRAMA, model);
        startActivity(context, intent);
    }

    /**
     * 跳转到录制界面
     *
     * @param context
     * @param isRecord 是否记录到“已点戏曲”
     */
    public void goRecordActivity(Context context, DianDramaModel model, boolean isRecord) {
        if (model == null) {
            return;
        }
        Intent intent = new Intent(context, RecordActivity.class);
        intent.putExtra(DataKey.DRAMA, model);
        intent.putExtra(DataKey.IS_RECORD, isRecord);
        startActivity(context, intent);
    }

    /**
     * 跳转到清唱界面
     *
     * @param context
     */
    public void goSingAloneActivity(Context context) {
        startActivity(context, new Intent(context, SingAloneActivity.class));
    }

    /**
     * 跳转到点唱列表
     *
     * @param context
     */
    public void goSingingListActivity(Context context, String title) {
        Intent intent = new Intent(context, SingingListActivity.class);
        intent.putExtra(DataKey.TITLE, title);
        startActivity(context, intent);
    }

    /**
     * 跳转到预览录音界面
     *
     * @param context
     */
    public void goPreviewRecordActivity(Context context, RecordModel model) {
        if (model == null) {
            LogUtil.e(TAG, "record drama model is null");
        }
        Intent intent = new Intent(context, PreviewRecordActivity.class);
        intent.putExtra(DataKey.DRAMA, model);
        startActivity(context, intent);
    }

    /**
     * 跳转到发布录制界面
     *
     * @param context
     * @param model   戏曲数据模型
     */
    public void goPublishRecordActivity(Context context, RecordModel model) {
        if (model == null) {
            return;
        }
        Intent intent = new Intent(context, PublishRecordActivity.class);
        intent.putExtra(DataKey.DRAMA, model);
        startActivity(context, intent);
    }

    /**
     * 跳转到测试api界面
     *
     * @param context
     */
    public void goAPITestActivity(Context context) {
        startActivity(context, new Intent(context, APITestActivity.class));
    }

    /**
     * 图片查看器
     *
     * @param context
     * @param imageList 图片集合
     */
    public void goPhotoViewActivity(Context context, List<String> imageList, int index) {
        Intent intent = new Intent(context, PhotoViewActivity.class);
        intent.putStringArrayListExtra(DataKey.IMAGE_LIST, (ArrayList<String>) imageList);
        intent.putExtra(DataKey.INDEX, index);
        startActivity(context, intent);
    }

    /**
     * 跳转到本地播放页面
     *
     * @param context
     * @param modelList 播放的戏曲集合
     * @param pos       当前播放的位置
     */
    public void goLocalPlayActivity(Context context, List<RecordModel> modelList, int pos) {
        if (modelList == null || modelList.isEmpty()) {
            LogUtil.e(TAG, "record model list is null or empty");
            return;
        }
        Intent intent = new Intent(context, LocalPlayActivity.class);
        intent.putExtra(DataKey.DRAMA_LIST, (Serializable) modelList);
        intent.putExtra(DataKey.DRAMA_POSITION, pos);
        startActivity(context, intent);
    }

    /**
     * 跳转到编译信息页面
     *
     * @param context
     */
    public void goBuildInfoActivity(Context context) {
        startActivity(context, new Intent(context, BuildInfoActivity.class));
    }

    private static class IntentManagerHolder {
        private static final IntentManager instance = new IntentManager();
    }

}
